package com.one.controller;


import com.one.dto.AfPageRequestDto;
import com.one.dto.PageResponseDto;
import com.one.entity.AqiFeedback;
import com.one.service.IAqiFeedbackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@Api(tags = "AQI反馈接口")
@RequestMapping("/aqiFeedback")
public class AqiFeedbackController {

	@Autowired
	private IAqiFeedbackService aqiFeedbackService;
	
	/********************** neps工程 **********************/
	@ApiOperation(value = "保存AQI反馈信息")
	@PostMapping("/saveAqiFeedback")
	public int saveAqiFeedback(@RequestBody AqiFeedback aqiFeedback) {
		log.info("保存Aqi反馈信息: {}", aqiFeedback);
		return aqiFeedbackService.saveAqiFeedback(aqiFeedback);
	}
	@ApiOperation(value = "根据监督员telId查询AQI反馈信息")
	@PostMapping("/listAqiFeedbackByTelId")
	public List<AqiFeedback> listAqiFeedbackByTelId(@RequestBody AqiFeedback aqiFeedback) {
		return aqiFeedbackService.listAqiFeedbackByTelId(aqiFeedback.getTelId());
	}
	
	/********************** neps工程 **********************/
	
	/********************** nepm工程 **********************/
	@ApiOperation(value = "分页查询所有的AQI反馈信息")
	@PostMapping("/listAqiFeedbackPage")
	public PageResponseDto<AqiFeedback> listAqiFeedbackPage(@RequestBody AfPageRequestDto afPageRequestDto){
		log.info("分页查询所有的AQI反馈信息: {}", afPageRequestDto);
		return aqiFeedbackService.listAqiFeedbackPage(afPageRequestDto);
	}

	@ApiOperation(value = "根据AqiFeedbackId查询AQI反馈信息")
	@PostMapping("/getAqiFeedbackById")
	public AqiFeedback getAqiFeedbackById(@RequestBody AqiFeedback aqiFeedback){
		log.info("根据AqiFeedbackId查询AQI反馈信息: {}", aqiFeedback.getAfId());
		return aqiFeedbackService.getAqiFeedbackById(aqiFeedback.getAfId());
	}

	@ApiOperation(value = "更新AQI反馈信息的网格员分配状态")
	@PostMapping("/updateAqiFeedbackAssign")
	public int updateAqiFeedbackAssign(@RequestBody AqiFeedback aqiFeedback){
		log.info("更新AQI反馈信息的网格员分配状态: {}", aqiFeedback);
		return aqiFeedbackService.updateAqiFeedbackAssign(aqiFeedback);
	}
	
	/********************** nepm工程 **********************/
	
	/********************** nepg工程 **********************/
	@ApiOperation("根据网格员Id查询其负责的AQI反馈")
	@PostMapping("/listAqiFeedbackByGmId")
	public List<AqiFeedback> listAqiFeedbackByGmId(@RequestBody AqiFeedback aqiFeedback){
		log.info("根据网格员Id查询其负责的AQI反馈: {}", aqiFeedback.getGmId());
		return aqiFeedbackService.listAqiFeedbackByGmId(aqiFeedback);
	}

	@ApiOperation("更新AQI反馈信息的处理状态")
	@PostMapping("/updateAqiFeedbackState")
	public int updateAqiFeedbackState(@RequestBody AqiFeedback aqiFeedback){
		log.info("更新AQI反馈信息的处理状态: {}", aqiFeedback);
		return aqiFeedbackService.updateAqiFeedbackState(aqiFeedback);
	}
	
	/********************** nepg工程 **********************/
}
